package com.example.demo;

import com.example.demo.dao.UserMapper;
import com.example.demo.servlet.SecondServlet;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;

//@SpringBootApplication(scanBasePackages = {"com.example"})
@SpringBootApplication   //@Configuration，@EnableAutoConfiguration，@ComponentScan
@ComponentScan(basePackages = {"com.example"})
@MapperScan(basePackages = {"com.example.demo.dao"})
@ServletComponentScan //spring boot启动时会自动扫描@WebServlet，@WebListener.@WebFilter注解，并将该类实例化
public class DemoApplication {

	private UserMapper userMapper;


	public static void main(String[] args) {
		SpringApplication.run(DemoApplication.class, args);
	}

	/**
	 * @Description:配置SecondServlet
	 * @Param:
	 * @return:
	 */
//	@Bean //Bean标签
//	public ServletRegistrationBean getServletRegistrationBean(){
//		ServletRegistrationBean bean = new ServletRegistrationBean(new SecondServlet());
//		bean.addUrlMappings("/second");
//		return bean;
//	}

}
